const expect=require('chai').expect;


describe('ownProperty',()=>{
    it('继承属性',()=>{
        expect({a:1}).ownProperty('toString');
    });

    it('本地属性',()=>{
        expect({a:1}).ownProperty('a');
    });

    it('本地不可枚举属性',()=>{
        let obj={};
        Object.defineProperty(obj,'a',{
            value:'A',
            enumerable:false
        });
        console.log('obj:',obj);
        expect(obj).ownProperty('a');
    });
});

describe('deep.ownProperty',()=>{
    it('一维数组',()=>{
        expect([1,2]).deep.ownProperty('0');
    });

    it('2维数组',()=>{
        expect([1,2,[3,4]]).deep.ownProperty('2[1]');
    });

    it('object',()=>{
        expect({a:'A',b:{
            c:'C',
            d:{
                e:'E'
            }
        }}).deep.ownProperty('c');
    });

});